<template>
  <div class="container">
    <div>
      <el-form ref="form" :model="form">
        <!-- <el-form-item label="考核任务名称：" label-width="110px">
          <el-input
            v-model="form.NAME"
            placeholder="请输入"
            class="handle-input mr10"
          ></el-input>
        </el-form-item> -->
        <el-form-item label="考核区域：" label-width="110px">
          <el-select v-model="form.QY" placeholder="请选择">
            <el-option
              v-for="item in options4"
              :key="item.QY"
              :label="item.QY"
              :value="item.QY"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="考核日期：" label-width="110px">
          <el-date-picker
            v-model="form.startDate"
            type="date"
            placeholder="选择日期"
            value-format="yyyy-MM-dd"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="考核人员：" label-width="110px">
          <el-select v-model="form.RY" placeholder="请选择">
            <el-option
              v-for="item in options2"
              :key="item.RY"
              :label="item.RY"
              :value="item.RY"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <!-- <el-divider></el-divider> -->
        <el-form-item label="考核任务类型：" label-width="110px">
          <el-select v-model="form.LX" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.LX"
              :label="item.LX"
              :value="item.LX"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="考核项目：" label-width="110px">
          <el-select v-model="form.XM" placeholder="请选择">
            <el-option
              v-for="item in options5"
              :key="item.XM"
              :label="item.XM"
              :value="item.XM"
            >
            </el-option>
          </el-select>
          </el-checkbox-group>
        </el-form-item>
        <el-form-item label="项目等级：" label-width="110px">
          <el-select v-model="form.DJ" placeholder="请选择">
            <el-option
              v-for="item in options6"
              :key="item.DJ"
              :label="item.DJ"
              :value="item.DJ"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="考核标准：" label-width="110px">
          <el-select v-model="form.BZ" placeholder="请选择">
            <el-option
              v-for="item in options1"
              :key="item.BZ"
              :label="item.BZ"
              :value="item.BZ"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="考核对象：" label-width="110px">
          <el-select v-model="form.DX" placeholder="请选择">
            <el-option
              v-for="item in options7"
              :key="item.DX"
              :label="item.DX"
              :value="item.DX"
            >
            </el-option>
          </el-select>
        </el-form-item>

        <!-- <el-row :gutter="20">
          <el-col :span="6">
            <el-form>
              <el-form-item label="抽样的方式：" label-width="110px">
                <el-select
                  style="width: 180px"
                  v-model="queryType"
                  placeholder="请选择"
                  @change="changeHandler"
                >
                  <el-option
                    v-for="item in queryTypeList"
                    :key="item.index"
                    :label="item.label"
                    :value="item.label"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-form>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form>
              <el-form-item label="" label-width="110px">
                <el-checkbox-group v-model="checkList1">
                  <el-checkbox label="按数量"></el-checkbox>
                  <el-checkbox label="按比例"></el-checkbox>
                </el-checkbox-group>
                
                <el-button
                type="success"
                @click="getAreaTeam"
                >地图范围绘制</el-button
              >
              </el-form-item>
            </el-form>
          </el-col>
          <el-col :span="6">
            <el-form ref="form" :model="form">
              <el-form-item>
                <el-input
                  style="width: 180px; height: 26px"
                  v-model="input"
                  :placeholder="inputPlaceholder"
                ></el-input>
              </el-form-item>
            </el-form>
          </el-col>
        </el-row> -->

        <!-- <el-form-item label="是否随机抽样：" label-width="110px">
            <el-radio-group v-model="checkList3">
            <el-radio  label="是"></el-radio >
            <el-radio   label="否"></el-radio >
            </el-radio-group>
        </el-form-item> -->

        <!-- <el-form-item label="针对性条件：" label-width="150px">
          <el-checkbox-group v-model="checkList2">
            <el-checkbox label="考核覆盖率"></el-checkbox>
            <el-checkbox label="黑名单"></el-checkbox>
            <el-checkbox label="上次考核不达标"></el-checkbox>
          </el-checkbox-group>
        </el-form-item> -->
      </el-form>
      <el-row type="flex" justify="center">
        <el-col :span="24"
          ><div align="center">
            <el-button
              type="primary"
              @click="saveAdd"
              style="width: 100%; margin-bottom: 18px"
            >
              生 成 考 核 任 务</el-button
            >
          </div></el-col
        >
      </el-row>
    </div>
    <el-table
      highlight-current-row
      :data="
        options3.slice((currentPage - 1) * pageSize, currentPage * pageSize)
      "
    >
      <!-- <el-table-column
        prop="name"
        label="抽样结果"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="type"
        label="类型"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="assess"
        label="条件"
        align="center"
      ></el-table-column> -->
      <!-- <el-table-column
        prop="NAME"
        label="考核任务名称"
        align="center"
      ></el-table-column> -->
      <el-table-column
        prop="khlx"
        label="考核任务类型"
        align="center"
      ></el-table-column>
      <!-- <el-table-column
        prop="khbz"
        label="考核内容"
        align="center"
      ></el-table-column> -->
      <el-table-column
        prop="khdx"
        label="考核项目"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="khdj"
        label="项目等级"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="khry"
        label="考核人员"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="khqy"
        label="考核区域"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="khsj"
        label="考核时间"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="khsj"
        label="创建日期"
        align="center"
      ></el-table-column>
      <!-- <el-table-column
        prop="zdxtj"
        label="针对性条件"
        align="center"
      ></el-table-column> -->
      <!-- <el-table-column
        prop="cy"
        label="抽样方式"
        align="center"
        width="200"
      ></el-table-column> -->

      <el-table-column label="考核内容" align="center">
        <template slot-scope="scope">
          <el-button type="text" @click="handleEdit(scope.$index, scope.row)"
            >详情</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <div class="pagination">
      <el-pagination
        background
        layout="total, sizes, prev, pager, next, jumper"
        :current-page="currentPage"
        :page-size="pageSize"
        :total="options3.length"
        @size-change="handleSizeChange"
        @current-change="handlePageChange"
      ></el-pagination>
    </div>
    <!-- 弹出框 -->
    <el-dialog
      :title="addDialogTitle"
      :visible.sync="isVisibleEdit"
      width="50%"
    >
      <el-table :data="tableData">
        <el-table-column
          prop="name"
          label="抽样结果"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="type"
          label="类型"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="assess"
          label="条件"
          align="center"
        ></el-table-column>
        <el-table-column
          prop=""
          label="标准"
          align="center"
        ></el-table-column>
      </el-table>
      <!-- <span slot="footer" class="dialog-footer">
        <el-button @click="isVisibleEdit = false">取 消</el-button>
        <el-button type="primary" @click="handleSubmit()">确 定</el-button>
      </span> -->
    </el-dialog>
  </div>
</template>
<script>
import '@/assets/css/common.css'

import export2Excel from '@/utils/exportExcel/index.js'
import OSS from 'ali-oss';
import { time } from 'echarts';
export default {
  data () {

    return {
      pickerOptions: {
        shortcuts: [{
          text: '最近一周',
          onClick (picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近一个月',
          onClick (picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近三个月',
          onClick (picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近六个月',
          onClick (picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 180);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近一年',
          onClick (picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 365);
            picker.$emit('pick', [start, end]);
          }
        },]
      },
      startDate: '',
      options: [
        { LX: '日常检查' },
        { LX: '抽查考核' },
        { LX: '集中评比' },],
      options1: [
        { BZ: '道路脏' },
        { BZ: '人行道脏' },
        //  {BZ: '公厕脏'},
        //  {BZ: '果皮箱脏'},
        //  {BZ: '垃圾箱脏'},
        //  {BZ: '转运站渗漏液不达标'},
      ],
      options2: [
        { RY: '林文献' },
        { RY: '王顺成' },
        { RY: '王五' },
        { RY: '何淑才' },
        { RY: '李俊珍' },
        { RY: '刘绍勇' },],
      options3: [
        { NAME: '日常考核', khlx: "日常检查", khbz: "道路脏", khdj: "一级", khry: "林文献", khqy: "东丽南片", khsj: "2021-10-07", khdx: "道路路段", zdxtj: "黑名单", cy: "不随机抽取" },
        { NAME: '抽查考核', khlx: "抽查考核", khbz: "人行道脏", khry: "林文献", khsj: "2021-10-01 ", khdx: "道路路段", zdxtj: "上次考核不达标", cy: "不随机抽取" },
        { NAME: '集中评比考核', khlx: "抽查考核", khbz: "道路脏", khry: "张明侠", khsj: "2019-12-01", khdx: "人行道脏", zdxtj: "上次考核不达标,黑名单", cy: "不随机抽取" },
        { NAME: '考核', khlx: "抽查考核", khbz: "道路脏", khry: "林文献", khsj: "2019-11-21", khdx: "道路路段", zdxtj: "考核覆盖率", cy: "按比例抽取:20" },
        { NAME: '考核', khlx: "抽查考核", khbz: "人行道脏", khry: "张明侠", khsj: "2019-10-01", khdx: "道路路段", zdxtj: "考核覆盖率", cy: "不随机抽取" },],

      options4: [
        { QY: '东丽西片' },
        { QY: '东丽东片' },
        { QY: '东丽南片' },],
      options5: [
        { XM: '道路机扫-车辆' },
        { XM: '道路机扫-道路' },
        { XM: '垃圾收运-车辆' },
        { XM: '公厕保洁-公厕' },],
      options6: [
        { DJ: '一级' },
        { DJ: '二级' },
        { DJ: '三级' },
        { DJ: '四级' },],
      options7: [
        { DX: '东城南路' },
        { DX: '环城南路' },
        { DX: '建设路' },
        { DX: '南关大街' },],
      dataRoadlist: [
        { "name": "东城南路", "type": "道路路段", "assess": "黑名单" },
        { "name": "环城南路", "type": "道路路段", "assess": "上次考核不达标" },
        { "name": "建设路", "type": "道路路段", "assess": "上次考核不达标" },
        { "name": "南关大街", "type": "道路路段", "assess": "黑名单" },
        { "name": "南三路", "type": "道路路段", "assess": "黑名单" },
        { "name": "渠阳路", "type": "道路路段", "assess": "上次考核不达标" },
        { "name": "钰华街", "type": "道路路段", "assess": "上次考核不达标" },
        { "name": "北城东路", "type": "道路路段", "assess": "上次考核不达标" },
        { "name": "北环路", "type": "道路路段", "assess": "上次考核不达标" },
        { "name": "津围公路", "type": "道路路段", "assess": "黑名单" },
        { "name": "渤海10路", "type": "道路路段", "assess": "上次考核不达标" },
        { "name": "渤海12路", "type": "道路路段", "assess": "上次考核不达标" },
        { "name": "渤海26路", "type": "道路路段", "assess": "黑名单" },
        { "name": "海河道", "type": "道路路段", "assess": "上次考核不达标" },
        { "name": "黄河道", "type": "道路路段", "assess": "上次考核不达标" },
        { "name": "黄浦江道", "type": "道路路段", "assess": "黑名单" },
        { "name": "辽河道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "瑞丽江道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "扬子江道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "长江道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "珠江道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "珠江一街", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "海滨五路", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "港城大道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "京门大道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "天保大道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "纬八道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "西九道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "中环东路", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "玉林道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "中昌南路", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "中山路", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "金钟河大街", "type": "道路路段", "assess": "黑名单" },
        { "name": "学府路", "type": "道路路段", "assess": "黑名单" },
        { "name": "黄海路", "type": "道路路段", "assess": "黑名单" },
        { "name": "常州道", "type": "道路路段", "assess": "黑名单" },
        { "name": "果园北道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "铁东北路", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "中心大道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "永久街", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "震新路", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "中心路", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "左江道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "迎宾街", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "梅州道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "德州道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "果园东路", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "辰昌路", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "龙飞道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "永进道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "振兴路", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "中新大道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "自由道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "医院路", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "南营道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "堤顶路", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "雍阳西道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "普济河东道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "龙门东道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "永安道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "育梁道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "中学西路", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "重庆道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "卫国道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "泉州道", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "洞庭路", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "北塘大街", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "京津路", "type": "道路路段", "assess": "考核覆盖率" },
        { "name": "北辰道", "type": "道路路段", "assess": "考核覆盖率" },
      ], dataCompanylist: [
        { "name": "仁仁洁集团", "type": "环卫作业公司", "assess": "黑名单" },
        { "name": "寿光环卫", "type": "环卫作业公司", "assess": "黑名单" },
        { "name": "中航环卫", "type": "环卫作业公司", "assess": "考核覆盖率" },
        { "name": "盈峰环境", "type": "环卫作业公司", "assess": "考核覆盖率" },
        { "name": "桑德环境", "type": "环卫作业公司", "assess": "考核覆盖率" },
        { "name": "锦江环境", "type": "环卫作业公司", "assess": "黑名单" },
        { "name": "中联环境", "type": "环卫作业公司", "assess": "上次考核不达标" },
        { "name": "北京环卫", "type": "环卫作业公司", "assess": "上次考核不达标" },
        { "name": "龙马环卫", "type": "环卫作业公司", "assess": "考核覆盖率" },
        { "name": "重庆环卫", "type": "环卫作业公司", "assess": "考核覆盖率" },
        { "name": "光大环境", "type": "环卫作业公司", "assess": "考核覆盖率" },
      ], dataToiletlist: [
        { "name": "红桥光荣道公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "西马路公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "白杨路公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "新开路公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "西南楼公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "京宝三纬路公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "解放南路公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "建设路公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "西青区支路公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "东丽傲都公厕", "type": "公厕", "assess": "黑名单" },
        { "name": "南京路以左公厕", "type": "公厕", "assess": "黑名单" },
        { "name": "龙门东道公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "南开四马路公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "卫津南路公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "冶金路公厕", "type": "公厕", "assess": "黑名单" },
        { "name": "建昌道公厕", "type": "公厕", "assess": "上次考核不达标" },
        { "name": "北辰道公厕", "type": "公厕", "assess": "上次考核不达标" },
        { "name": "六纬路公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "普济河东道公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "河北大街辅路公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "铁东北路公厕", "type": "公厕", "assess": "黑名单" },
        { "name": "浯水道公厕", "type": "公厕", "assess": "上次考核不达标" },
        { "name": "津南洞庭路公厕", "type": "公厕", "assess": "上次考核不达标" },
        { "name": "保泽道公厕", "type": "公厕", "assess": "黑名单" },
        { "name": "纪念馆路公厕", "type": "公厕", "assess": "黑名单" },
        { "name": "金海道公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "子牙河南路公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "黑牛城道公厕", "type": "公厕", "assess": "考核覆盖率" },
        { "name": "北六马路公厕", "type": "公厕", "assess": "上次考核不达标" },
        { "name": "北辰道辅路公厕", "type": "公厕", "assess": "黑名单" },
        { "name": "广开大街公厕", "type": "公厕", "assess": "上次考核不达标" },
        { "name": "海河东路公厕", "type": "公厕", "assess": "上次考核不达标" },
        { "name": "金钟河大街公厕", "type": "公厕", "assess": "黑名单" },
      ], dataZZZlist: [
        { "name": "海泰转运站", "type": "转运站", "assess": "上次考核不达标" },
        { "name": "双口南转运站", "type": "转运站", "assess": "上次考核不达标" },
        { "name": "京福转运站", "type": "转运站", "assess": "黑名单" },
        { "name": "双口北转运站", "type": "转运站", "assess": "考核覆盖率" },
        { "name": "李七庄转运站", "type": "转运站", "assess": "考核覆盖率" },
        { "name": "新城转运站", "type": "转运站", "assess": "考核覆盖率" },
        { "name": "中塘转运站", "type": "转运站", "assess": "考核覆盖率" },
        { "name": "小王庄转运站", "type": "转运站", "assess": "考核覆盖率" },
        { "name": "丰年街富安路转运站", "type": "转运站", "assess": "考核覆盖率" },
        { "name": "万新街雪山路转运站", "type": "转运站", "assess": "黑名单" },
        { "name": "张贵庄利福道转运站", "type": "转运站", "assess": "上次考核不达标" },
        { "name": "金钟街金丽道转运站", "type": "转运站", "assess": "上次考核不达标" },
        { "name": "华新街华一路转运站", "type": "转运站", "assess": "黑名单" },
        { "name": "华明街津赤路转运站", "type": "转运站", "assess": "黑名单" },
        { "name": "机场东区转运站", "type": "转运站", "assess": "考核覆盖率" },
        { "name": "机场西区转运站", "type": "转运站", "assess": "考核覆盖率" },
        { "name": "东丽湖垃圾转运站", "type": "转运站", "assess": "考核覆盖率" },
        { "name": "军粮城临时垃圾转运站", "type": "转运站", "assess": "考核覆盖率" },
        { "name": "无暇街垃圾转运站", "type": "转运站", "assess": "考核覆盖率" },
        { "name": "新立新市镇垃圾转运站", "type": "转运站", "assess": "考核覆盖率" },
        { "name": "东丽机场转运站", "type": "转运站", "assess": "考核覆盖率" },
        { "name": "东丽机场东区-机场4号门转运站", "type": "转运站", "assess": "考核覆盖率" }
      ], dataCLClist: [
        { "碧海环保垃圾处理厂": "滨海新区垃圾焚烧发电厂", "处理厂": "处理厂", "考核覆盖率": "上次考核不达标" },
        { "碧海环保垃圾处理厂": "滨海新区第二垃圾焚烧发电厂", "处理厂": "处理厂", "考核覆盖率": "考核覆盖率" },
        { "碧海环保垃圾处理厂": "双口生活垃圾卫生填埋场", "处理厂": "处理厂", "考核覆盖率": "上次考核不达标" },
        { "碧海环保垃圾处理厂": "泰环垃圾处理厂", "处理厂": "处理厂", "考核覆盖率": "黑名单" },
        { "碧海环保垃圾处理厂": "双港垃圾焚烧发电厂", "处理厂": "处理厂", "考核覆盖率": "黑名单" },
        { "碧海环保垃圾处理厂": "光大环保垃圾处理厂", "处理厂": "处理厂", "考核覆盖率": "考核覆盖率" },
        { "碧海环保垃圾处理厂": "中环节餐厨垃圾处理厂", "处理厂": "处理厂", "考核覆盖率": "考核覆盖率" },
        { "碧海环保垃圾处理厂": "中环节垃圾焚烧处理厂", "处理厂": "处理厂", "考核覆盖率": "上次考核不达标" },

      ], dataPointlist: [
        { "武警医院": "金钟街社区卫生服务中心", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "华明社区卫生服务中心", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "华新街社区卫生服务中心", "垃圾收集点": "垃圾收集点", "考核覆盖率": "黑名单" },
        { "武警医院": "东丽湖街社区卫生服务中心", "垃圾收集点": "垃圾收集点", "考核覆盖率": "上次考核不达标" },
        { "武警医院": "东丽湖第二发热门诊", "垃圾收集点": "垃圾收集点", "考核覆盖率": "上次考核不达标" },
        { "武警医院": "安宁医院", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "东丽中医医院", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "东丽医院", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "海港城冷库", "垃圾收集点": "垃圾收集点", "考核覆盖率": "黑名单" },
        { "武警医院": "万科小镇菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "上次考核不达标" },
        { "武警医院": "万科阳光菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "上次考核不达标" },
        { "武警医院": "世纪好又多超市", "垃圾收集点": "垃圾收集点", "考核覆盖率": "黑名单" },
        { "武警医院": "华侨城菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "黑名单" },
        { "武警医院": "赵沽里冷库", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "赵沽里批发市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "大毕庄菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "何庄子菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "上次考核不达标" },
        { "武警医院": "新市镇第二菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "黑名单" },
        { "武警医院": "新市镇第三菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "上次考核不达标" },
        { "武警医院": "新市镇第一菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "上次考核不达标" },
        { "武警医院": "新中村菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "黑名单" },
        { "武警医院": "徐庄菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "上次考核不达标" },
        { "武警医院": "畅悦华庭菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "上次考核不达标" },
        { "武警医院": "程林东里菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "黑名单" },
        { "武警医院": "程盛道菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "南大桥菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "万新菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "正达菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "福山路菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "丽新里菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "天津市国顺肉类食品有限公司", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "华明晚市", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "华明早市", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "华新早市", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "李明庄菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },
        { "武警医院": "民心菜市场", "垃圾收集点": "垃圾收集点", "考核覆盖率": "考核覆盖率" },

      ],
      checkList1: ['道路路段'],
      checkList2: ['考核覆盖率'],
      checkList3: '是',
      clientData: [],
      currentPage: 1, //初始页
      pageSize: 10,    //    每页的数据
      originalData: [],
      tableData: [],
      select: {
        CPH: ''
      },
      isVisibleEdit: false,
      input: 1,
      inputPlaceholder: '请输入数量',
      queryType: '',
      queryTypeList: [{
        value: 1,
        label: '全部抽样'
      }, {
        value: 2,
        label: '条件抽样'
        // }, {
        //   value: 3,
        //   label: '按比例抽取'
        // // }, {
        // //   value: 3,
        // //   label: '整群抽样'
        // // }, {
        // //   value: 4,
        // //   label: '机械抽样'
        }, {
          value: 5,
          label: '地图绘制范围抽样'
      }],
      labelwidth: 100,
      addDialogTitle: '',
      form: {
        WaterCPH: "",
        WaterTime: "",
        CreateTime: "",
        WaterNumber: "",
        WaterLocation: "",
        WaterCphType: "",
        WaterPeople: "",
        WaterPeopleID: "",
      },
      tableData: [],
      contentTags: ['道路路段', '环卫作业公司', '公厕'],
      contentTags2: ['考核覆盖率', '黑名单', '上次考核不达标'],
      conditionTags: ['按数量抽取', '按比例抽取', '按地图绘制范围'],
      inputVisible: false,
      inputValue: '',
      isRandom: false,
      isRandomInput: ''
    }
  },
  created () {

    // if (localStorage.getItem('CTYPE') == '0') {
    //   this.rolelevel.shift()
    // } else if (localStorage.getItem('CTYPE') != '-1') {
    //   this.rolelevel = []
    // }
    // this.getClientRoleList()
  },
  mounted () {
    // this.getlistdataAssess()
    // this.getClientRoleList()
    // this.originalData = data
    // this.screeningData()
  },
  methods: {
    // 打开编辑窗口
    // handleEdit (index, row) {
    //   this.form = Object.assign({}, row);
    //   this.addDialogTitle = '考核内容详情'
    //   this.isVisibleEdit = true;
    // },
    // getlistdataAssess () {
    handleEdit (index, row) {
      // this.form = Object.assign({}, row);
      var checkList1 = row.khdx.split(",");
      var checkList2 = row.zdxtj.split(",");
      if (row.cy === '不随机抽取') {
        this.isRandom = false;
      } else {
        this.isRandom = true;
        this.isRandomInput = row.cy
      }
      this.addDialogTitle = '考核内容详情'
      this.isVisibleEdit = true;
      this.currentPage = 1;
      this.tableData = []
      if (checkList1.includes('道路路段')) {
        this.screenAssess(checkList2, this.dataRoadlist)
      } if (checkList1.includes('公厕')) {
        this.screenAssess(checkList2, this.dataToiletlist)
      }
      if (checkList1.includes('转运站')) {
        this.screenAssess(checkList2, this.dataZZZlist)
      }
      if (checkList1.includes('处理厂')) {
        this.screenAssess(checkList2, this.dataCLClist)
      }
      if (checkList1.includes('垃圾收集点')) {
        this.screenAssess(checkList2, this.dataPointlist)
      }
      if (checkList1.includes('环卫作业公司')) {
        this.screenAssess(checkList2, this.dataCompanylist)
      }
      console.log(checkList2, this.tableData)
    },
    screenAssess (checkList2, array) {
      checkList2.forEach(element => {
        var arrayReturn = []
        array.forEach(item => {
          if (item.assess === element) {
            arrayReturn.push(item)
          }
        });
        if (this.isRandom) {
          switch (this.isRandomInput.split(":")[0]) {

            case '按数量抽取':
              {
                var count = this.isRandomInput.split(":")[1]
                this.tableData = this.tableData.concat(arrayReturn.slice(0, count))
              }
              break;
            case '按比例抽取':
              {
                var count = this.isRandomInput.split(":")[1]
                count = count * arrayReturn.length / 100
                this.tableData = this.tableData.concat(arrayReturn.slice(0, count))
              }
              break;
            case 4:
              {
                var count = Math.ceil(Math.random() * 10) + 5;
                this.tableData = this.tableData.concat(arrayReturn.slice(0, count))
              }
              break;
          }
        } else {
          this.tableData = this.tableData.concat(arrayReturn)
        }
      });
    },
    changeHandler () {

    },
    handleClose (tag) {
      this.contentTags.splice(this.contentTags.indexOf(tag), 1);

    },
    handleClose1 (tag) {
      this.conditionTags.splice(this.conditionTags.indexOf(tag), 1);
    },

    showInput () {
      this.inputVisible = true;
      this.$nextTick(_ => {
        this.$refs.saveTagInput.$refs.input.focus();
      });
    },

    handleInputConfirm () {
      let inputValue = this.inputValue;
      if (inputValue) {
        this.contentTags.push(inputValue);
      }
      this.inputVisible = false;
      this.inputValue = '';
    },
    handleInputConfirm1 () {
      let inputValue = this.inputValue;
      if (inputValue) {
        this.conditionTags.push(inputValue);
      }
      this.inputVisible = false;
      this.inputValue = '';
    },

    // 导入Excel
    onChange (file, fileList) {
      //  console.log(fileList);
      this.fileData = file; // 保存当前选择文件
      this.readExcel(); // 调用读取数据的方法
    },
    // 读取数据
    readExcel (e) {
      let that = this;
      const files = that.fileData;
      console.log(files);
      if (!files) {
        //如果没有文件
        return false;
      } else if (!/\.(xls|xlsx)$/.test(files.name.toLowerCase())) {
        this.$message.error("上传格式不正确，请上传xls或者xlsx格式");
        return false;
      }
      const fileReader = new FileReader();
      console.log(fileReader)
      fileReader.onload = ev => {
        try {
          const data = ev.target.result;
          //  console.log(ev.target)
          //  console.log(this);
          const workbook = this.XLSX.read(data, {
            type: "binary"// 以字符编码的方式解析
          });

          if (workbook.SheetNames.length >= 1) {
            //  this.$message({
            //    message: "导入数据表格成功",
            //    showClose: true,
            //    type: "success"
            //  });

            const wsname = workbook.SheetNames[0]; //取第一张表
            const ws = this.XLSX.utils.sheet_to_json(workbook.Sheets[wsname]); //生成json表格内容
            console.log(ws)
            this.inputExcelDataLength = ws.length
            this.fullscreenLoading = this.$loading({
              lock: true,
              text: 'Loading',
              spinner: 'el-icon-loading',
              background: 'rgba(0, 0, 0, 0.7)'
            })
            for (let i = 0, len = ws.length; i < len; i++) {
              var item = ws[i]
              //   var sheetData = {
              //     VID: item['居民电话'],
              //     RUBBISH_NAME: item["垃圾品名"],
              //     WEIGHT: item["垃圾称重"],
              //     photo: '',
              //     LONGITUDE: 0,
              //     LATITUDE: 0
              //   }
              //   let exceldata =  []
              //   exceldata.push(sheetData)
              this.addWeight(item)
            }
          } else {
            this.$message.error("未读取到表格内容");
          }
        } catch (e) {
          return false;
        }
      };
      // 如果为原生 input 则应是 files[0]
      fileReader.readAsBinaryString(files.raw);
    },
    async addWeight (item) {
      this.$axios({
        url: 'CarService/AddCarAddWaterInfo',
        method: 'post',
        data: {
          WaterCPH: item['车牌照号'],
          WaterTime: item['加水时间'],
          CreateTime: item['上传时间'],
          WaterNumber: item['加水量（吨）'],
          WaterLocation: item['加水地点'],
          WaterCphType: item['加水类型'],
          WaterPeople: item['加水人员'],
          WaterPeopleID: item['加水人员编号'],
        }
      }).then(res => {
        console.log(res)
        this.inputExcelDataIndex++

        if (res.data.IsSucess) {
          this.fullscreenLoading.close()
          this.$message.success('表格文件导入成功')
          this.getlistdata()
        } else {
          this.fullscreenLoading.close()
          this.$message.error('表格文件导入失败' + '，' + res.data.Message);

        }
        if (this.inputExcelDataIndex == this.inputExcelDataLength) {
          this.fullscreenLoading.close()
          if (this.strError.length == 0) {
            this.$message.success('表格文件导入成功')
          } else {
            // this.$message.error('表格文件导入结束<br/>' + this.strError);
            this.$message({
              message: '表格文件导入结束，' + this.strError,
              type: 'error',
              duration: 5000
            })
          }
          this.getlistdata()
        }
      })
      //   })
    },
    // 导出Excel
    exportExcel () {
      let excelName = '车辆加水记录'
      const tHeader = ['加水记录编号', '车牌照号', '加水时间', '上传时间', '加水量（吨）', '加水地点', '加水类型', '加水人员', '加水人员编号']
      const filterVal = ['ID', 'WaterCPH', 'WaterTime', 'CreateTime', 'WaterNumber', 'WaterLocation', 'WaterCphType', 'WaterPeople', 'WaterPeopleID']
      export2Excel(tHeader, filterVal, this.tableData, excelName)
    },
    // 打开新增窗口
    handleAdd () {
      this.addDialogTitle = '新增车辆加水信息'
      //清空编辑框
      this.form = {
        WaterCPH: "",
        WaterTime: "",
        CreateTime: "",
        WaterNumber: "",
        WaterLocation: "",
        WaterCphType: "",
        WaterPeople: "",
        WaterPeopleID: "",
      }
      //展示窗口
      this.isVisibleEdit = true;
      // this.idEdit = false;
    },

    // 点击保存，判断是新增还是编辑操作
    handleSubmit () {
      if (this.addDialogTitle == '新增车辆加水信息') {
        this.saveAdd()
      } else {
        this.saveEdit()
      }
    },
    // 新增保存
    async saveAdd () {
      if (this.queryType == "不随机抽取") {
        this.$set(this.options3, 6, { NAME: this.form.NAME, khlx: this.form.LX, khbz: this.form.BZ, khry: this.form.RY, khsj: this.form.startDate, khdx: this.checkList1 + ",", cy: this.queryType, zdxtj: this.checkList2 + ",", })
        this.options3.splice(6, 0)
        this.$message.success('成功生成');
      } else {
        this.$set(this.options3, 6, { NAME: this.form.NAME, khlx: this.form.LX, khbz: this.form.BZ, khry: this.form.RY, khsj: this.form.startDate, khdx: this.checkList1 + ",", cy: this.queryType + ":" + this.input, zdxtj: this.checkList2 + ",", })
        this.options3.splice(6, 0)
        this.$message.success('成功生成');
      }

    },
    // 保存编辑
    async saveEdit () {
      this.$axios({
        url: 'CarService/UpdataCarAddWaterInfo',
        method: 'post',
        data: {
          ID: this.form.ID,
          WaterCPH: this.form.WaterCPH,
          WaterTime: this.form.WaterTime,
          CreateTime: this.form.CreateTime,
          WaterNumber: this.form.WaterNumber,
          WaterLocation: this.form.WaterLocation,
          WaterCphType: this.form.WaterCphType,
          WaterPeople: this.form.WaterPeople,
          WaterPeopleID: this.form.WaterPeopleID,
        },

      }).then((res) => {
        console.log(this.data)
        console.log(res)
        if (res.data.IsSucess) {
          this.$message.success('编辑成功');
          this.isVisibleEdit = false
          this.getlistdata()
        } else {
          this.$message.error('编辑失败');
        }
      })
    },
    // 删除车辆信息
    async handleDelete (index, row) {
      const confirmResult = await this.$confirm('确定删除？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).catch(err => err)
      if (confirmResult == 'confirm') {
        const params = {
          ID: row.ID,
        }
        const { data } = await this.$Http.get('CarService/DeleteCarAddWaterInfo', { params })
        if (data.IsSucess) {
          this.$message.success('删除成功')
          this.isVisibleEdit = false
          this.getlistdata()
        } else {
          this.$message.error('删除失败');
        }
      } else {
        this.$message.info('取消删除')
        this.isVisibleEdit = false
      }

    },
    // 模糊查询
    screeningData () {
      this.tableData = this.originalData
      if (this.select.CPH) this.tableData = this.tableData.filter(item => item.CPH.includes(this.select.CPH))
    },
    // 分页导航
    handlePageChange (currentPage) {
      this.currentPage = currentPage;
      // console.log(this.currentPage)
      // this.$set(this.query, 'pageIndex', val);
      // this.getlistdata();
    },
    handleSizeChange (size) {
      this.pageSize = size;
      console.log(this.pageSize)
    }
  }
}
</script>
<style>
.el-form-item__label {
  text-align: left;
}
/* .el-checkbox {
  color: #fff;
}
.el-checkbox__label {
  color: #fff !important;
} */
.content {
  overflow-y: scroll;
}
.el-col-6 {
  width: 350px;
  min-height: 50px;
}
.el-table th {
  height: 40px;
}
.el-form-item label {
  width: 80px;
}
.el-tag + .el-tag {
  margin-left: 10px;
}
.button-new-tag {
  margin-left: 10px;
  height: 32px;
  line-height: 30px;
  padding-top: 0;
  padding-bottom: 0;
}
.input-new-tag {
  height: 32px;
  line-height: 30px;
  width: 90px;
  margin-left: 10px;
  vertical-align: bottom;
}
.aroundtop {
  padding: 10px;
  background-color: #007acc;
  height: 100%;
  border-radius: 5px;
}
.el-icon-speed {
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  height: 30px;
  line-height: 28px;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  margin: 10px 20px 10px 20px;
}
</style>